<template>
	<!--头部-->
	<div class="myContent">
		<!--头部-->
		<!--<header class="aui-bar aui-bar-nav aui-bar-light">
			<router-link to="afterSaleList" replace>
				<div class="go-back">
					<i></i>
					<i></i>
					<i></i>
				</div>
			</router-link>
			<div class="aui-title">申请售后服务</div>
		</header>-->
		<!--头部-->    <!--:IDGModel="true" :IDGInputSelector="['#afterSaleOederNode']"  IOS 11版本 让dom在软键盘关闭的时候做一次快速的重新渲染 -->
		<my-header :title="'申请售后服务'" :hasTitle="true" :hasBack="true" :goBack="goBack" :IDGModel="true" :IDGInputSelector="['#afterSaleOederNode']"></my-header>
		<!--<div style="height:3rem;"></div>-->
		<div id="AfterSaleOutBox"  style="flex:1;overflow-y:auto;">
			<div id="afterSaleContent">
				<div class="centent top_div">
					<!--商品列表-->
					<div class="aui-content">
						<ul class="aui-list aui-media-list commodity_list subtotal_list" style="text-align: left;">
							<li class="aui-list-item">
								<div class="aui-media-list-item-inner">
									<div class="aui-list-item-media">
										<!--<img :src="getItemImg(shopObj)">  shopObj.goodsImg || 'static/image/demo1.png'-->
										<img v-lazy="getItemImg(shopObj)  || 'static/image/demo2.png'">
									</div>
									<div class="aui-list-item-inner suggest">
										<h3 style="min-height: 1.5rem;">{{shopObj.goodsName}}</h3>
										<p v-if="shopObj.buyType!=4&&shopObj.realTotalMoney || shopObj.buyType!=4&&shopObj.realTotalMoney==0">总价：¥{{Number(shopObj.realTotalMoney).toFixed(2)}}</p>    <!--getSingerPrice(shopObj)-->
										<p v-if="shopObj.buyType==4">积分单价：{{shopObj.realPrice}}</p>
										<!--产品确认售后不显示规格-->
										<!--<p v-if="shopObj.goodsSpec">{{shopObj.goodsSpec? '规格：' + shopObj.goodsSpec : "&nbsp;"}}</p>-->
										<p v-if="shopObj.goodsType != 7">数量：{{shopObj.outGoodsNum}} <span style="color: #9E9E9E;" v-if="shopObj.goodsType != 6">/{{shopObj.mallUnit}}</span> <span style="color: #9E9E9E;" v-if="shopObj.goodsType == 6">{{shopObj.mallUnit}}</span></p>
										<p v-if="shopObj.goodsType == 7">重量：{{shopObj.outGoodsNum*1000}}g</p>
									</div>
								</div>
							</li>
							<!--v-if="orderServeList"-->
							<li class="message_list" style="position: relative;padding: 0 0.75rem;padding-bottom: 0.75rem;" v-if="sendArr && sendArr.length" >
								<div class="aui-list-item-arrow01 server_show" style="background-color: #fff2f2;padding: 0.2rem 0.5rem;">
									<!--<div style="margin-left: 0.5rem;" class="aui-list-item-arrow_1" v-for="(server,index) in orderServeList" :key="index">
										<h4>[服务]</h4>
										<dl>
											<dd>
												<font>{{server.serveName}}</font>
												<span>¥{{server.servePrice}}×{{server.serveNum}}</span>
											</dd>
											<dd>
											<font>全保换新1年</font>
											<span>¥88.8×2</span>
										</dd>
										</dl>
									</div>-->
	
									<div style="margin-left: 15;" class="aui-list-item-arrow_2" >
										<h4 style="text-align:left;">[赠品]</h4>
										<dl v-for="(item,index) in sendArr"  :key="index">
											<dd>
												<font>{{item.goodsName}}</font>
												<span>¥{{getSingerPrice(item)}}×{{item.outGoodsNum}}</span>
											</dd>
										</dl>
									</div>
								</div>
							</li>
						</ul>
					</div>
				</div>
				<div class="aui-content aui-margin-b-15">
					<ul class="aui-list aui-list-in" style="text-align: left;">
						<li class="aui-list-item aui-content aui-list aui-form-list">
							<div class="aui-list-item-inner">
								<div class="aui-list-item-label" style="width:30%;">售后类型：</div>
								<div class="aui-list-item-input">
									<p>{{shopObj.buyType!=4?aftermarkettype:'退积分'}}</p>
								</div>
							</div>
						</li>
						<li class="aui-list-item aui-content aui-list aui-form-list">
							<div class="aui-list-item-inner">
								<div class="aui-list-item-label" style="width:30%;" v-if="shopObj.goodsType != 7">{{this.aftermarkettype == '退款'?'退款':'退货'}}数量：</div>
								<div class="aui-list-item-input" v-if="shopObj.goodsType != 7">
									<p>可退数量：{{canBackNum}} <span v-if="shopObj.goodsType != 6">/{{shopObj.mallUnit}}</span> <span v-if="shopObj.goodsType == 6">{{shopObj.mallUnit}}</span> </p>
								</div>
								<div class="aui-list-item-label" style="width:30%;" v-if="shopObj.goodsType == 7">{{this.aftermarkettype == '退款'?'退款':'退货'}}重量：</div>
								<div class="aui-list-item-input" v-if="shopObj.goodsType == 7">
									<p>可退重量：{{shopObj.outGoodsNum*1000}}g</p>
								</div>
								<!-- v-if="shopObj.goodsType != 7 && shopObj.buyType!=4"称重散卖的不能选择数量 -->
								<div class="edit_data" style="bottom:0.4rem;" v-if="aftermarkettype == '退货退款' && shopObj.goodsType != 7">   <!--加购的商品-->
									<i class="del_cart" :class="{edit_data_click:(actureBackNum !=1&& canBackNum > actureBackNum) || (canBackNum> 1 && canBackNum == actureBackNum)}" @click="delCount"></i><span ref="money">{{actureBackNum}}</span><i @click.stop="addCount"  class="add_to_cart" :class="{add_to_cart_no:canBackNum < actureBackNum||canBackNum == actureBackNum}"></i>
								</div>
							</div>
						</li>
						<li class="aui-list-item aui-content aui-list aui-form-list">
							<div class="aui-list-item-inner" style=" white-space: nowrap; overflow: hidden; text-overflow: ellipsis">
								<div class="aui-list-item-label" style="width:30%;">退款金额：</div>
								<div class="aui-list-item-input">
									<!--<input type="number" placeholder="最多￥200，含发货邮费￥6.00">-->
									<p v-if="shopObj.buyType!=4"><span class="aui-text-danger">¥{{refundamount}}</span>（实际退款金额以审核为准）</p>
								    <p v-if="shopObj.buyType==4"><span class="aui-text-danger">{{shopObj.realTotalMoney}}积分</span></p>
								</div>
							</div>
						</li>
						<!--@click="showBackReasonList"-->
						<li class="aui-list-item" @click.stop="showPopup1">
							<div class="aui-list-item-inner aui-list-item-arrow" style=" white-space: nowrap; overflow: hidden; text-overflow: ellipsis">
								<div class="aui-list-item-title">
									{{this.aftermarkettype == '退款'?'退款':'退货'}}原因：
	
								</div>
								<p>{{upLoaddata.serviceReason?upLoaddata.serviceReason:'请选择'}}</p>
							</div>
						</li>
                        <!-- this.aftermarkettype === '退货退款'  // 5.24 产品要求将配送员上门取件默认为用户选择的方式 不给用户选择展示-->
						<li class="aui-list-item" @click.stop="showGoBackPopup" v-if="false">
							<div class="aui-list-item-inner aui-list-item-arrow" style=" white-space: nowrap; overflow: hidden; text-overflow: ellipsis">
								<div class="aui-list-item-title">
									<!--{{this.aftermarkettype == '退款'?'退款':'退货'}}原因：-->
									退回方式：
								</div>
								<p>{{upLoaddata.goodsReturnWay?goBackMethods[upLoaddata.goodsReturnWay-1].case:'请选择'}}</p>
							</div>
						</li>
						<!--showGoBackPopup-->
						<!--<li class="aui-list-item  checkeB" v-if="showBackReason">
						<p v-for="(item,index) in backMoneyReason"  @click="changeCheckFlag(item,index)" key="index">
							<input type="checkbox"  v-model ="item.flag" />{{item.case}}
						</p>
					</li>-->
						<li class="aui-list-item aui-content aui-list aui-form-list">
							<div class="aui-list-item-inner">
								<div class="aui-list-item-label" style="width:30%;"><span>{{this.aftermarkettype == '退款'?'退款':'退货'}}说明：</span></div>
								<div class="aui-list-item-input">
									<!--@click.stop="showPopupReason"-->
									<textarea type="text" maxlength="100" placeholder="选填" class="liuyan" id="afterSaleOederNode" ref="note" v-model="reasonmsg"></textarea>
									<!--<textarea id="status" name="status" rows="6" cols="40" v-on:input="sshow"></textarea>-->
								</div>
							</div>
						</li>
						<!--@click="showpackingCaseList"-->
						<!--<li class="aui-list-item" v-if="aftermarkettype =='退货退款' "  @click.stop="showPopup2">
						<div class="aui-list-item-inner aui-list-item-arrow">
							<div class="aui-list-item-title">包装情况：</div>
							<p>请选择</p>
						</div>
					</li>-->
						<li class="aui-list-item aui-content aui-list aui-form-list" v-if="aftermarkettype =='退货退款' ">
							<div class="aui-list-item-inner">
								<div class="aui-list-item-label" style="width:30%;">质量情况：</div>
								<div class="aui-list-item-input">
									<label v-for="(pack,index) in packingCase" style="margin-left:0.1rem;" :key='index'><input class="aui-radio" type="radio" name="demo1" @click.stop="changePacking(index)" :checked="pack.flag"> {{pack.case}}</label>
									<!--<label><input class="aui-radio" type="radio" name="demo1"> 包装损坏</label>-->
								</div>
							</div>
						</li>
						<!--<li class="aui-list-item packingCase" v-if="showpackingCase">
						<p v-for="(item1,index) in packingCase"  key="index">
							<input type="checkbox"  v-model ="item1.flag" />{{item1.case}}
						</p>
					</li>-->
					</ul>
					<img-UpLoad style="padding: 0px 0.75rem;background-color: #fff;" ref="imgUp" :toast="false" :autoClear="false" v-if="aftermarkettype =='退货退款' "></img-UpLoad>
					<!--<ul class="aui-list aui-list-in" v-if="aftermarkettype =='退货退款' ">
					<li class="aui-list-item aui-content aui-list aui-form-list">
						<div class="aui-list-item-inner">
							<div class="aui-list-item-label" style="width:30%;">提交凭证：</div>
							<div class="aui-list-item-input">
								<p>最多可上传5张</p>
							</div>
						</div>
					</li>
	
					<li class="aui-list-item aui-list-item-middle aui-margin-b-15">
						<div class="aui-card-list-content-padded aui-border-b aui-border-t aui-padded-l-0 aui-padded-t-0">
							<div class="aui-row aui-row-padded">
								<div class="aui-col-xs-4">
									<img src="static/image/demo1.png" />
								</div>
								<div class="aui-col-xs-4">
									<img src="static/image/demo1.png" />
								</div>
								<div class="aui-col-xs-4">
									<img src="static/image/demo1.png" />
								</div>
								<div class="aui-col-xs-4">
									<img src="static/image/demo1.png" />
								</div>
								<div class="aui-col-xs-4">
									<img src="static/image/suneee-btn.png" />
								</div>
							</div>
						</div>
					</li>
				</ul>-->
				</div>
				<div style="height:4rem;" id="afterSaleScroll"></div>
			</div>
			
			<!--<div class="aui-mask aui-mask-in" style="display: none;"></div>-->

			<!--<popup v-model="popupVisible2" position="bottom">
				<div id="purchase_service02">

					<div class="spec_middle">

						<div class="value_added">
							<ul class="aui-list aui-media-list top_div aui-list-header" style="margin-bottom:0;">
								<div>
									选择质量情况
								</div>
								<li class="aui-list-item" style="padding-left:0;">
									<div class="aui-list aui-media-list commodity_list">
										<div class="aui-list-item-inner " v-for="(pack,index) in packingCase">
											<label class="aui-pull-left"><input class="aui-checkbox" type="checkbox" name="demo1" :checked="pack.flag"> {{pack.case}}</label>
										</div>
									</div>
								</li>
							</ul>
						</div>
					</div>
					<div class="settle_accounts lijixiadan settle_accounts_2">
						<div id="confirm" class="aui-btn aui-btn-danger aui-btn-block aui-btn-sm" @click.stop="getPackingCheck">确定</div>
					</div>
				</div>
			</popup>
			<popup v-model="popupReason" pop-transition="popup-fade">
				<div>
					{{reasonmsg}}
				</div>
			</popup>-->
		</div>
		<div class="settle_accounts aui-btn aui-btn-block aui-btn-danger" style="line-height: 2.5rem;height: 2.5rem;border-radius: 0px;">
			<div style="font-size: 1rem;" tapmode @click.stop="updataApplication">提交申请</div>
		</div>
		<popup v-model="popupGoBack" position="bottom">
			<div id="purchase_service">
				<div class="spec_middle">
					<div class="value_added" style="min-height: 50vh;">
						<ul class="aui-list aui-media-list top_div aui-list-header" style="margin-bottom:0;">
							<div>
								选择退回方式
							</div>
							<li class="aui-list-item" style="padding-left:0;">
								<div class="aui-list aui-media-list commodity_list">
									<div class="aui-list-item-inner " v-for="(item,index) in goBackMethods" :key="index">
										<label class="aui-pull-left"><input class="aui-checkbox" type="checkbox" @click.stop="changeGoBackFlag($event, index, item.case)" :checked="item.flag">&nbsp;{{item.case}} </label>
									</div>
								</div>
							</li>
						</ul>
					</div>
				</div>
				<div class="settle_accounts lijixiadanC settle_accounts_1" @click.stop="getGoBackFlag">
					<div id="confirm" class="aui-btn aui-btn-danger aui-btn-block aui-btn-sm">确定</div>
				</div>
			</div>
		</popup>
		<popup v-model="popupVisible" position="bottom">
			<div id="purchase_service">
				<!--class="purchase_service"-->
				<div class="spec_middle">

					<div class="value_added" style="min-height: 50vh;">
						<ul class="aui-list aui-media-list top_div aui-list-header" style="margin-bottom:0;">
							<div v-if="backMoneyReason && backMoneyReason.length">
								选择{{this.aftermarkettype == '退款'?'退款':'退货'}}原因

							</div>
							<div style="margin-top: 1rem;" v-if="!backMoneyReason || !backMoneyReason.length">
								未获取到原因列表，请稍候再试
							</div>
							<li class="aui-list-item" style="padding-left:0;">
								<div class="aui-list aui-media-list commodity_list">
									<!--backMoneyReason-->
									<div class="aui-list-item-inner " v-for="(item,index) in backMoneyReason" :key="index">
										<label class="aui-pull-left"><input class="aui-checkbox" type="checkbox" @click.stop="changeCheckFlag($event, index, item.case)" :checked="item.flag">&nbsp;{{item.case}} </label>
									</div>
									<!--:checked="index === reasonCheckedIndex"-->
								</div>
							</li>
						</ul>
					</div>
				</div>
				<div class="settle_accounts lijixiadanC settle_accounts_1 aui-btn aui-btn-danger aui-btn-block aui-btn-sm" @click.stop="getBackReason">
					<div id="confirm" style="font-size: 1rem;">确定</div>
				</div>
			</div>
		</popup>
	</div>
</template>

<script>
	import { mapGetters, mapActions } from 'vuex';
	import axios from "axios";
	import { Popup } from 'mint-ui';
	import ImgUpLoader from '../../real-components/ImgUpload/index';
	import { Toast } from "../../utils/toast";
	import { showLoading, hideLoading } from "../../utils/loading";
	import {translatePrice} from "../../utils/TranslatePriceC";
	import myHeader from '../header';
	//	import api from "../../api/index.js";
	const api = window.api;

	export default {
		data() {
			return {
				userSessionid: null,
				popupVisible: false,
				popupGoBack:false,
//				popupVisible2: false,
//				popupReason: false,
				aftermarkettype: '',
				refundamount: '',
				reasonmsg: '',
				canBackNum: 10, //可退货数量
				actureBackNum: 10, //申请退货数量
				showBackReason: false,
				showpackingCase: false,
				upFlag: false,
				imgStatus: {},
				shopObj: {},
				backMoneyReasonId: null,
				isImg:false, // 是否需要上传图片
				orderServeList: null,
				parentNo: null, //总单号
				childNo:null, // 子单号
				afterSaleInfoAll: null, //售后单信息
				orderInfo: null, //总订单信息
				backMoneyState: null,
				goBackMethods:[{   // 5.24 产品要求将配送员上门取件默认为用户选择的方式 不给用户选择展示
						case: '配送员上门取件',
						flag: true
					},{
						case: '自行送货至门店',
						flag: false
					}
				],
				backMoneyReason: [],
				
				backMoneyReasonXW: [],  //从后台获取的所有的售后原因
				backMoneyReason2:[],  //存放可用的售后原因
				packingCase: [{
						case: '质量完好',
						flag: false
					},
					{
						case: '质量不好',
						flag: false
					}
				],
				afterSaleArr:[],  // 赠品与商品信息
				sendArr:[], //赠品
				addMoneyArr:[],  // 加价购商品信息
				afterSaleGoodsArr:[], // 申请售后商品信息
				//用于发起请求
				upLoaddata: {
                    "goodsReturnWay":1, // 5.24 产品要求将配送员上门取件默认为用户选择的方式 不给用户选择展示
					"enterpriseCode": null, //企业Code
					"applyAmount": null, //申请金额
					"serviceType": "2", //售后类型
					"serviceReason": null, //退货退款原因
					"serviceDesc": null, //退货退款描述
					"userPhone": "13826020035", //联系电话
					"goodsServernos": '', //服务单号
					"applyTm": null, //申请时间
					"orderNo": null, //订单编号
					"goodsList":[],
					"token":null,
				},
				add:0, // 单个商品实付金额
				promotionMinis:0, //一类商品的优惠金额
				goodsPrice: 0 ,//单个商品的原价
				weighingFlag:false, // 是否是称重商品
				storeCode:null,
				orderType:null,
				tokens:null,
			}
		},
		components: {
			"popup": Popup,
			"imgUpLoad": ImgUpLoader,
			"my-header":myHeader
		},
		watch: {
			actureBackNum(newValue, oldValue) {
				this.actureBackNumData = newValue;
			}
		},
		methods: {
			goBack() {
				let num = this.$route.query.tangShi;
				if(num){
					// this.$router.replace('order');
					window.history.go(-1)
				}else{
					this.$router.replace('afterSaleList');
				}
				// this.$router.replace('afterSaleList');
			},
			getItemImg(item){
				if(item.goodsImg){
					var str = item.goodsImg.split(' ')[0];
					return str;
				}
//				else{
//					return 'static/image/demo1.png'
//				}
			},
			//获取商品单价
			getSingerPrice(item){
				if(item.goodsType != 6){
					return item.realPrice;
				}else{
					var singerPrice = Number(item.realTotalMoney) / Number(item.outGoodsNum);
					console.log(item,singerPrice,'price价格')
					var price = translatePrice(singerPrice);
					console.log(price,'price价格')
					return price
				}
			},
			//获取申请售后接口信息 金额 商品信息
			getAfterSaleInfo(){
				console.log(this.$route.query.orderNo,this.$route.query.goodsCode,this.$route.query);
//				console.log(this.$route.query.routerInfor,'routerInfor传过来的信息')
				var orderNo = this.$route.query.orderNo;
//				var goodscode_buytype = this.$route.query.goodsCode + '_' + this.$route.query.rid;
				var goodscode_buytype =  this.$route.query.rid;
				let url = window.api.trade_host + '/order/selectForOneAfterSale' + '/' + orderNo + '/' + goodscode_buytype;

				let config = {
					url:url,
					method: "GET",
					headers: {
						sessionId: localStorage.getItem('sessionId'),
					}
				}
				axios(config).then((res)=>{
					if(res.data.returnCode == 1){
						console.log(res.data.data[1],'查询利民接口');
						console.log(res.data.data,'查询利民接口2');
						this.storeCode = res.data.data[1];
						var arr = res.data.data[0].orderGoodsList;
						this.orderType = res.data.data[0].orderType;
	//					console.log(arr,'报错');
						//所有的售后商品信息
						this.afterSaleGoodsArr = res.data.data[0].orderGoodsList;
						this.upLoaddata["token"] = res.data.data[2];
						// this.upLoaddata["token"] = 'aaa52785-0cd8-4823-9e0f-7beece2845b6';
						for(let i = 0; i < arr.length; i++){
	//						buyType  1 代表所买的商品   2代表加购商品  3代表赠品  4代表积分购买商品  加价购可以单独申请退 但是与称重的一样不能选择退的数量
							if(arr[i].buyType == 1 || arr[i].buyType == 2 || arr[i].buyType == 4){
								this.shopObj = arr[i];  // 主商品
								this.afterSaleArr.push(arr[i]) // 主商品数组
							}
							if(arr[i].buyType == 3){
								this.sendArr.push(arr[i]);  // 赠品
							}
							
						}
						
						console.log(this.sendArr,'赠品数组')
						this.childNo = this.shopObj.orderNo;
						var type = res.data.data[0].type;
						this.getServerType(type);
						this.getReason();   //获取售后原因
						this.getQuery();
					}else{
						Toast({
							message: res.data.msg,
							type: 'fail',
							duration: 1000
						});
					}
					
					
				})
			},
			//确定是退货退款还是退款
			getServerType(type) {
				//称重商品不能只退部分  全都退
//				type 1 是退款  2 是 退货退款
//								console.log('=====================----+++++------------+++++++++++++++=======');
				let obj = this.shopObj;
				if(obj.goodsType == 6 || obj.goodsType == 7){
					this.weighingFlag = true;
				}
				if(type == 1) {
					//console.log(11111111);
					this.upLoaddata["serviceType"] = "1";
					this.aftermarkettype = "退款";
				} else if(type == 2) {
					//					console.log(22222222);
					this.upLoaddata["serviceType"] = "2";
					this.aftermarkettype = "退货退款";
				}
				//				this.aftermarkettype = "退货退款";
//				this.showReason();
			},
			//调用图片上传回调   发起退货退款申请
			getImgUrl(res) {
				this.imgStatus = res;
				if(res.data) {
					this.upLoaddata.voucherPhoto = res.data.join(',');
				}
				this.updataApplication();
			},
//			goodsImg(goodsItemData) {
//	            if (goodsItemData && goodsItemData.urllist) {
//	                if(goodsItemData.urllist.length) {
//	                	for(let i = 0 ; i < goodsItemData.urllist.length; i++){
//	                		if(goodsItemData.urllist[i].Imgurltype == 0){
//	                			return goodsItemData.urllist[i].imgurl || "static/image/demo1.png";
//	                		}
//	                	}
//	                } else {
//	                    return "static/image/demo1.png";
//	                }
//	            } else {
//	                return "static/image/demo1.png";
//	            }
//	        },
			//上传图片 调用插件
			upMethod() {
				// if(this.aftermarkettype == '退货退款') {
				// 	this.upLoadImg();
				// } else {
					this.updataApplication();
				// }
			},
			showPopup1() {
				this.popupVisible = true;
			},
			showPopupReason() {
//				this.popupReason = true;
			},
			//获取后台退款 退货退款原因设置
			getReason(){
				let url = window.api.service_host  + "/afterSaleReason/selectReasonList";
				let config = {
					url: url,
					headers: {
						sessionId: localStorage.getItem('sessionId'),
					},
					method: "GET"
				}
				axios(config).then((res)=>{

					if(res.status == 200 && res.data.returnCode == 1){
//						console.log(res.status,res.data.returnCode,res.data.data,'後臺請求售後原因');
						this.backMoneyReasonXW = res.data.data;
						for(let i = 0 ; i < this.backMoneyReasonXW.length; i++){
							if(this.aftermarkettype == '退款'){
								if(this.backMoneyReasonXW[i].type == 1 && this.backMoneyReasonXW[i].isShow == 1){
									let obj = {};
									obj.case = this.backMoneyReasonXW[i].reasonContext;
									obj.flag = false;
									obj.isImg = this.backMoneyReasonXW[i].isImg;
									this.backMoneyReason2.push(obj);
								}
							}else if(this.aftermarkettype == '退货退款'){
								if(this.backMoneyReasonXW[i].type == 2 && this.backMoneyReasonXW[i].isShow == 1){
									let obj = {};
									obj.case = this.backMoneyReasonXW[i].reasonContext;
									obj.isImg = this.backMoneyReasonXW[i].isImg;
									obj.flag = false;
									this.backMoneyReason2.push(obj);
								}
							}
						}
						this.backMoneyReason = this.backMoneyReason2;
						console.log(this.backMoneyReason2,'部分原因');
					}
				})
			},
			//获取申请退款金额  暂时先不计算运费
			getRefundamount() {
				let routeObj = this.shopObj;
				//计算优惠券后的商品单价（优惠券后台均摊到单个商品）   outGoodsNum
				console.log(routeObj.realTotalMoney,'計算金額')
				if(routeObj.goodsType == 7){
					this.refundamount = Number(routeObj.realTotalMoney).toFixed(2);
					return;
				}
				let singePrice = Number(routeObj.realTotalMoney) / Number(routeObj.outGoodsNum); 
				this.refundamount = singePrice * this.actureBackNum;   // 此時計算的是主商品的退款金額  
				var refundamountMoney = Number(this.refundamount);
				
//				if(this.sendArr && this.sendArr.length){          //计算加赠品后的价格  赠品是0 元
//					for(let i = 0; i < this.sendArr.length; i++){
//						refundamountMoney += Number(this.sendArr[i].realPrice) * Number(this.sendArr[i].goodsNum);
//					}
//				}
//				console.log(this.refundamount,'金额')
//				this.refundamount = Number(refundamountMoney).toFixed(2);
				this.refundamount = this.fixedNum(refundamountMoney);
			},
			//只保留两位小舒，不进行四舍五入
			fixedNum(str){
				var num = Number(str).toFixed(3);
					num = num.substring(0,num.lastIndexOf('.')+3);
					return num;
//				console.log(num,num.substring(0,num.lastIndexOf('.')+3),'修正小数')
			},
			
			//获取申请退款金额  计算运费
//			getRefundamount() {
//				let routeObj = this.shopObj;
//				//计算优惠券后的商品单价（优惠券后台均摊到单个商品）  
//				console.log(routeObj.realTotalMoney,'計算金額')
//				if(routeObj.goodsType == 6 || routeObj.goodsType == 7){
//					if(routeObj.freight){
//						this.refundamount = ((routeObj.realTotalMoney) + Number(routeObj.freight)).toFixed(2);
//					}else{
//						this.refundamount = (routeObj.realTotalMoney).toFixed(2);
//					}
//					return;
//				}
//				let singePrice = Number(routeObj.realTotalMoney) / Number(routeObj.goodsNum);
//				//				console.log(singePrice);
//				if(this.aftermarkettype == '退货退款') {
//					this.refundamount = (singePrice * this.actureBackNum).toFixed(2);
//					
//				} else if(this.aftermarkettype == '退款') {
//
//					if(Number(this.actureBackNum) == Number(routeObj.canAfterSaleNum)) {
//
//						if(this.backMoneyState === 0) {
//							this.refundamount = (singePrice * this.actureBackNum + Number(routeObj.freight)).toFixed(2);
//						} else {
//							this.refundamount = (singePrice * this.actureBackNum).toFixed(2);
//						}
//					} else {
//						this.refundamount = (singePrice * this.actureBackNum).toFixed(2);
//					}
//				}
//			},

			//是否退运费控制函数    实体商品退完了，就给用户退运费（虚拟商品不存在运费）

			backFreight() {
				//				afterSaleInfoAll:null,//售后单信息
				//				orderInfo:null, //总订单信息
				var arr = this.afterSaleInfoAll;
				//该订单中进行过售后的售后单信息  如果为空未进行过售后
				var afterSale = [];

				for(let i = 0; i < this.afterSaleInfoAll.length; i++) {
					//进行过售后
					if(arr[i].parentOrderno == this.parentNo) {
						afterSale.push(arr[i]);
					}
				}

				//申请售后的实体商品数量
				var afterSaleCount = 0;
				//获取申请售后的实体商品数量
				for(let j = 0; j < afterSale.length; j++) {
					//					console.log("//获取申请售后的实体商品数量", afterSale[j]);
					if(parseInt(afterSale[j].goodsType) == 0) {
						//						console.log("//获取申请售后的实体商品数量1111");
						afterSaleCount += Number(afterSale[j].goodsQuantity);
					}
				}
				//获取总订单中的实体商品数量
				//				console.log(this.orderInfo);
				let orderList = this.orderInfo[0].childOrderList;

				let goodsNum = 0;
				orderList.forEach(item => {
					item.orderDetails.forEach(item2 => {
						if(item2.goodsType == 0) {
							goodsNum += item2.goodsNum;
						}
					})
				});
				//				console.log(66666666666666666);
//				console.log(goodsNum, afterSaleCount, parseInt(this.actureBackNum),'asas');
				if(goodsNum == (afterSaleCount + parseInt(this.actureBackNum))) {
					//退完了
					return 0;
				} else {
					//没退完
					return 1;
				}
			},
			//初始化可退数量  后计算金额
			getQuery() {
				let obj = this.shopObj;
//				this.shopObj = this.$route.query;
				console.log(this.shopObj,'shop');
				this.canBackNum = obj.canAfterSaleNum; //可退货数量
				
//				if(obj.goodsType == 7){
//					this.canBackNum = 1000;  //如果是称重散装商品 让它的可退数量大点  避免检验失败
//				}
				
				this.actureBackNum = obj.canAfterSaleNum;

				if(obj.orderServeList) {
					//console.log(999999999999, obj.orderServeList==false)
					this.orderServeList = JSON.parse(obj.orderServeList);
					if(this.orderServeList.length) {
						this.upLoaddata.goodsServernos = this.orderServeList[0].serveId;
					}
				}
				//获取总单号 查询总单信息
				this.parentNo = obj.parentOrderNo;
				console.log(this.parentNo,'总订单号');
				this.getRefundamount();
//				this.getAfterSale();
				//console.log(this.parentNo,'总单')

			},
			//计算非赠品单类商品申请金额
			getGoodsApplyAmount(){
				var refundamountMoney = 0;
				if(routeObj.goodsType == 7){
					refundamountMoney = Number(routeObj.realTotalMoney).toFixed(2);
				}else{
					let singePrice = Number(routeObj.realTotalMoney) / Number(routeObj.outGoodsNum); 
					refundamountMoney = singePrice * this.actureBackNum;   // 此時計算的是主商品的退款金額  
					refundamountMoney = Number(refundamountMoney);
				}
				return refundamountMoney;
				
			},
			getAfterSaleAfterList(){
				//判断是否是主商品  如果是主商品  申请售后的数量就为用户选择的数量  如果为赠品那么就全都退
				var arr = [];
//				this.afterSaleGoodsArr   申请售后的商品列表
//				this.sendArr   申请售后的赠品列表

//				主商品   buyType  1 代表所买的商品   2代表加购商品  3代表赠品
				for(let i = 0; i < this.afterSaleGoodsArr.length; i++){
					if(this.afterSaleGoodsArr[i].buyType == 1 || this.afterSaleGoodsArr[i].buyType == 2){
						let obj = {};
						//称重的传重量  非称重的传数量
						if(this.afterSaleGoodsArr[i].goodsType == 7){
							obj["actualWeight"] = this.afterSaleGoodsArr[i].outGoodsNum;
						}else{
							obj["applyQuantity"] = this.actureBackNum;
                        }
                        obj["goodsName"] = this.afterSaleGoodsArr[i].goodsName;
						obj["goodsImg"] = this.afterSaleGoodsArr[i].goodsImg;
						obj["goodsId"] = this.afterSaleGoodsArr[i].goodsId;
						obj["goodsCode"] = this.afterSaleGoodsArr[i].goodsCode;
						obj["goodsType"] = this.afterSaleGoodsArr[i].goodsType;
						obj["buyType"] =   this.afterSaleGoodsArr[i].buyType;
						obj["goodsApplyAmount"] = Number(this.refundamount); //单类商品申请金额  赠品申请退款金额为0 
//						console.log(this.afterSaleGoodsArr[i].actualWeight,'称重重量')
						//单个商品成交金额参数
						var item1 = this.afterSaleGoodsArr[i];
						obj["goodsOriginalPrice"] = this.afterSaleGoodsArr[i].goodsPrice; //商品原价
						obj["orderGoodsId"] = this.afterSaleGoodsArr[i].rid; //商品rid
						obj["giftFrom"] = this.afterSaleGoodsArr[i].giftFrom; //商品giftFrom
						obj["goodsDealPrice"] = this.getSingerPrice(item1); //成交價    goodsType 为6 的商品 价格不能取 realPrice
						obj["goodsDiscountPrice"] = this.afterSaleGoodsArr[i].promotionMinis; //优惠金额
						obj["workingInfo"] = this.afterSaleGoodsArr[i].workingInfo; //workingInfo
						
						if(this.afterSaleGoodsArr[i].mallUnit && this.afterSaleGoodsArr[i].goodsType == 7) {
							obj["goodsSpec"] = this.afterSaleGoodsArr[i].mallUnit;
						}else if(this.afterSaleGoodsArr[i].mallUnit) {
							obj["goodsSpec"] = this.afterSaleGoodsArr[i].mallUnit;
						}
						// if(this.orderGoodsList&&this.orderGoodsList[i].goodsUnit) {
						// 	obj["goodsSpec"] = this.afterSaleGoodsArr[i].goodsUnit;
						// }
						arr.push(obj);
					}else if(this.afterSaleGoodsArr[i].buyType == 4){
						let obj = {};
						//称重的传重量  非称重的传数量
						if(this.afterSaleGoodsArr[i].goodsType == 7){
							obj["actualWeight"] = this.afterSaleGoodsArr[i].outGoodsNum; 
						}else{
							obj["applyQuantity"] = this.afterSaleGoodsArr[i].outGoodsNum;
						}
						obj["goodsName"] = this.afterSaleGoodsArr[i].goodsName;
						obj["goodsImg"] = this.afterSaleGoodsArr[i].goodsImg;
						obj["goodsId"] = this.afterSaleGoodsArr[i].goodsId;
						obj["goodsCode"] = this.afterSaleGoodsArr[i].goodsCode;
						obj["goodsType"] = this.afterSaleGoodsArr[i].goodsType;
						obj["buyType"] =   this.afterSaleGoodsArr[i].buyType;
						console.log(this.afterSaleGoodsArr[i].actualWeight,'称重重量')
						//单个商品成交金额参数
						var item2 = this.afterSaleGoodsArr[i];
						obj["goodsOriginalPrice"] = this.afterSaleGoodsArr[i].goodsPrice; //商品原价
						obj["orderGoodsId"] = this.afterSaleGoodsArr[i].rid; //商品rid
						obj["giftFrom"] = this.afterSaleGoodsArr[i].giftFrom; //商品giftFrom
						obj["goodsDealPrice"] = this.getSingerPrice(item2); //成交價
						obj["goodsDiscountPrice"] = this.afterSaleGoodsArr[i].promotionMinis; //优惠金额
						obj["goodsApplyAmount"] = this.refundamount ; //单类商品申请金额  赠品申请退款金额为0 
						obj["workingInfo"] = this.afterSaleGoodsArr[i].workingInfo; //workingInfo
						if(this.afterSaleGoodsArr[i].mallUnit) {
							obj["goodsSpec"] = this.afterSaleGoodsArr[i].mallUnit;  // 规格字段 直接传的单位  前端取用
						}
						arr.push(obj);
					}
				}
//				赠品
				for(let j = 0 ; j < this.sendArr.length; j++){
					if(this.sendArr[j].buyType == 3){
						let obj = {};
						//称重的传重量  非称重的传数量
						if(this.sendArr[j].goodsType == 7){
							obj["actualWeight"] = this.sendArr[j].outGoodsNum; 
						}else{
							obj["applyQuantity"] = this.sendArr[j].outGoodsNum;
						}
						obj["goodsName"] = this.sendArr[j].goodsName;
						obj["goodsImg"] = this.sendArr[j].goodsImg;
						obj["goodsId"] = this.sendArr[j].goodsId;
						obj["goodsCode"] = this.sendArr[j].goodsCode;
						obj["goodsType"] = this.sendArr[j].goodsType;
						obj["buyType"] =   this.sendArr[j].buyType;
						console.log(this.sendArr[j].actualWeight,'称重重量')
						//单个商品成交金额参数
						var item2 = this.sendArr[j];
						obj["goodsOriginalPrice"] = this.sendArr[j].goodsPrice; //商品原价
						obj["orderGoodsId"] = this.sendArr[j].rid; //商品rid
						obj["giftFrom"] = this.sendArr[j].giftFrom; //商品giftFrom
						obj["goodsDealPrice"] = this.getSingerPrice(item2); //成交價
						obj["goodsDiscountPrice"] = this.sendArr[j].promotionMinis; //优惠金额
						obj["goodsApplyAmount"] = 0 ; //单类商品申请金额  赠品申请退款金额为0 
						obj["workingInfo"] = this.afterSaleGoodsArr[j].workingInfo; //workingInfo
						if(this.sendArr[j].mallUnit) {
							obj["goodsSpec"] = this.sendArr[j].mallUnit;  // 规格字段 直接传的单位  前端取用
						}
						arr.push(obj);
					}
				}
				
				console.log(arr,'传入后台申请售后的goodsList');
				return arr;
				
			},
			//根据门店code获取门店名称
			getStoreName(code){
//				console.log(code,'45445545');
				//获取首页存的门店
				var list = this.getStoreList;
//				console.log(list,'999999');
				var store = null;
				for(let i = 0; i < list.length; i++){
					if(code == list[i].storeCode){
						store = list[i].storeName;
						console.log(store,'//8/8/8/8/8/8/8/');
					}
				}
				return store;
			},
			getParams() {
				if(window.localStorage.getItem('sessionId')) {
					this.userSessionid = window.localStorage.getItem('sessionId');
				}
				//				console.log(userSessionid);
				if(this.userSessionid && this.userInfo != null) {
					this.upLoaddata["userPhone"] = this.userInfo.mobile;
					this.upLoaddata["enterpriseCode"] = window.api.enterpriseCode;

				}

				this.upLoaddata["shopName"] = this.getStoreName(this.storeCode); //获取门店名称
				this.upLoaddata["serviceDesc"] = this.reasonmsg;
				//售后申请时间
				this.upLoaddata["applyTm"] = new Date().getTime();
				
				this.upLoaddata["orderCreateTm"] = this.shopObj.createTm;
			
				this.upLoaddata["orderNo"] = this.childNo; // 子单号
				this.upLoaddata["goodsList"] = this.getAfterSaleAfterList();
				this.upLoaddata["applyAmount"] = this.refundamount;
				this.upLoaddata["orderType"] = this.orderType;
			},
			delCount() {
				let count = this.actureBackNum;
				if(count > 1 && count <= this.canBackNum) {
					this.actureBackNum--;
				}
				this.getRefundamount();
				//				console.log(this.actureBackNum);
			},
			addCount() {
				let count = this.actureBackNum;
				if(count > 0 && count < this.canBackNum) {
					this.actureBackNum++;
				}
				this.getRefundamount();
				//				console.log(this.actureBackNum);
			},
			changeCheckFlag(event, index, reason) {

				for(let i = 0; i < this.backMoneyReason.length; i++) {

					//	if(!this.backMoneyReason[i].flag){
					if(i == index) {
						this.backMoneyReason[i].flag = true;
						//如果当前点击的仍然为选中的那一个，选中状态保留
						if(this.backMoneyReason[i].case === reason) {
							event.target.checked = true;
						}

					} else {
						this.backMoneyReason[i].flag = false;
					}
//					console.log(this.backMoneyReason[i], i, '原因切换')
				}
			},
			getBackReason() {

				for(let i = 0; i < this.backMoneyReason.length; i++) {
					if(this.backMoneyReason[i].flag) {
						this.upLoaddata.serviceReason = this.backMoneyReason[i].case;
						if(this.backMoneyReason[i].isImg == 1){
							this.isImg = true;
						}else{
							this.isImg = false;
						}
					}
				}
				this.popupVisible = false;
			},
			showGoBackPopup() {
				this.popupGoBack = true;
			},
			changeGoBackFlag(event, index, methodType){
				for(let i = 0; i < this.goBackMethods.length; i++) {
					if(i == index) {
						this.goBackMethods[i].flag = true;
						//如果当前点击的仍然为选中的那一个，选中状态保留
						if(this.goBackMethods[i].case === methodType) {
							event.target.checked = true;
						}

					} else {
						this.goBackMethods[i].flag = false;
					}
				}
			},
			getGoBackFlag() {
				for(let i = 0; i < this.goBackMethods.length; i++) {
					if(this.goBackMethods[i].flag) {
//						this.upLoaddata.serviceReason = this.goBackMethods[i].case;	
						this.upLoaddata.goodsReturnWay = Number(i+1);
						console.log(this.goBackMethods[i].case,'用户选择退回方式');
					}
				}

				this.popupGoBack = false;
			},
			//获取packing参数    实现checked选中的值，点击切换
			changePacking(index) {
				//				console.log(123456);
				for(let i = 0; i < this.packingCase.length; i++) {
					if(!this.packingCase[i].flag) {
						if(i == index) {
							this.packingCase[i].flag = true;
							this.upLoaddata.packing = Number(i);
						} else {
							this.packingCase[i].flag = false;
						}
					} else {
						this.packingCase[i].flag = false;
					}
				}

				if(this.packingCase[0].flag == false && this.packingCase[1].flag == false) {
					this.upLoaddata.packing = null;
				}

			},
			//提交请求前校验
			checkInfo() {

				var obj = this.upLoaddata;
				console.log(this.upLoaddata.packing, 'this.upLoaddata.packing')
				if(this.aftermarkettype == "退货退款") {
					//部分原因需要上传图片
					var flag = false;
					console.log(this.isImg,this.upLoaddata.packing)
					if(this.isImg) {
						flag = true;
					}

					if(!obj.serviceReason) {
						Toast({
							message: '请选择申请原因',
							type: 'fail',
							duration: 1000
						});
						return;
					} else if(!obj.goodsReturnWay){
						Toast({
							message: '请选择退回方式',
							type: 'fail',
							duration: 1000
						});
						return;
						
					}else if(obj.packing == null || obj.packing == undefined) {
						Toast({
							message: '请选择质量情况',
							type: 'fail',
							duration: 1000
						});
						return;
					} else if(this.imgStatus.status == 2 && flag) {

						Toast({
							message: '请上传商品图片',
							type: 'fail',
							duration: 1000
						});
						//		                console.log(this.upFlag,'是否请求2');
						return;
					} else if(this.imgStatus.status == 0 && flag) {
						//						console.log('图片验证')
						Toast({
							message: '上传图片失败',
							type: 'fail',
							duration: 1000
						});
						//		                console.log(this.upFlag,'是否请求0');
						return;
					} else if(Number(this.actureBackNum) > Number(this.canBackNum) || Number(this.actureBackNum) < 0) {
						Toast({
							message: '申请数量有误',
							type: 'fail',
							duration: 1000
						});
						return;
					} else {
						this.upFlag = true;
						return;
					}

				} else if(this.aftermarkettype == "退款") {
					if(!obj.serviceReason) {
						Toast({
							message: '请选择申请原因',
							type: 'fail',
							duration: 1000
						});
						return;
					} else if(Number(this.actureBackNum) > Number(this.canBackNum) || Number(this.actureBackNum) < 0) {
						Toast({
							message: '申请数量有误',
							type: 'fail',
							duration: 1000
						});
						return;
					} else {
						//						console.log(12346)
						this.upFlag = true;
						return;
					}
				}
			},
			//上传图片
			upLoadImg() {
				this.$refs.imgUp.upload();
			},
			async updataApplication() {
				//图片参数\
				if(this.aftermarkettype == "退货退款"){
					let imgObj =  await this.$refs.imgUp.upload();
					this.imgStatus = imgObj;
					if(imgObj.data) {
						this.upLoaddata.voucherPhoto = imgObj.data.join(',');
					}
				}
                
				this.getParams();
				this.checkInfo();
//				console.log(JSON.stringify(this.upLoaddata),'請求參數');
				if(window.localStorage.getItem('sessionId')) {
					this.userSessionid = window.localStorage.getItem('sessionId');
				}
				let url = window.api.service_host + "/afterSales/insertOrUpdateAfterSales";

				let config = {
					url: url,
					headers: {
						'sessionId': window.localStorage.getItem('sessionId'),
						'Content-Type': 'application/json',
						'Accept': 'application/json'
					},
					data: this.upLoaddata,
					method: "POST"
				};
				console.log(this.upLoaddata, '请求参数');
				
				console.log(JSON.stringify(this.upLoaddata), '请求参数');
		
				if(this.upFlag) {

					showLoading();
					axios(config).then((res) => {
//						console.log(res.data.returnCode,'后台返回')
						if(res.data.returnCode == 1) {
							Toast({
								message: '申请已提交',
								type: 'success',
								duration: 1000
							});
							hideLoading();
							let num = this.$route.query.tangShi;
							if(num){
								// this.$router.replace('afterSaleList');
								window.history.go(-1);
							}else{
								this.$router.replace('afterSaleList');
							}
							

						} else {
//									res.data.errmsg
							Toast({
								message:'申请失败' ,
								type: 'fail',
								duration: 1000
							});
							this.upLoaddata["token"] = res.data.data[0];
							// console.log("奇迹而啊",this.upLoaddata["token"])
							hideLoading();
						}
					}).catch((err) => {
						hideLoading();
					})
				}
			},
			/* 已弃用 获取售后单信息 getAfterSale()  =>   获取订单信息getOrderInfo() => 计算是否要退运费 backFreight() => 计算总退款金额*/
			//获取售后单信息
			getAfterSale() {
				//省悟
				//				let url = "http://172.19.5.136:8112/afterSales/selectAfterSales/1127684370832207";
//				let url = api.local_host + "/afterSales/selectAfterSalesList" + '?' + "token=" + new Date().getTime();
				let url = api.service_host + "/afterSales/selectAfterSalesList" + '?' + "token=" + new Date().getTime();
				if(window.localStorage.getItem('sessionId')) {
					this.userSessionid = window.localStorage.getItem('sessionId');
				}
				let config = {
					url: url,
					headers: {
						//						4409883a17dd4721812b804d4741c6da
						'sessionId': window.localStorage.getItem('sessionId'),
						'Content-Type': 'application/json',
						'Accept': 'application/json'
					},
					method: "GET"
				};
				axios(config).then((res) => {
					this.afterSaleInfoAll = res.data.data;
//					this.getOrderInfo();
					//					console.log(this.afterSaleInfoAll,'售后单');
				})
			},
			//获取订单信息
			getOrderInfo() {
				let sess = window.localStorage.getItem('sessionId');
				// /order/selectOrderDetailYN/
//				let url = window.api.local_host + '/order/selectOrderDetailYN/' + this.parentNo;
				let url = window.api.trade_host+'/order/selectOrderDetail/'+ this.parentNo;
				let config = {
					url: url,
					headers: {
						'sessionId': sess,
						'Content-Type': 'application/json',
						'Accept': 'application/json'
					}
				};

				axios(config).then(res => {
					console.log(res.data.data,'獲取訂單信息');
					this.orderInfo = res.data.data;
//					this.backMoneyState = this.backFreight();
					//获取退款金额信息
					//					console.log(this.backMoneyState,'this.backMoneyState');
//					this.getRefundamount();
//					this.getPriceParams(this.orderInfo);
				})
			},
			//监听买家留言框的focus事件 开始
	        initTextareaFocusEvent() {
	            this.$refs.note.onfocus = () => {
	                console.log("input框框获取到了焦点");
	                this.initInputStyle();
	            }
	            this.$refs.note.onblur = () => {
	                console.log("失去焦点");
	                //重置样式
	                this.unsetStyle();
	                
	            }
	        },
	        //监听滑动事件
	        listenOnblur(){
//	        	removeEventListener
	        	var bo = document.getElementsByTagName('body')[0];
	        	var that = this;
	        	bo.addEventListener('touchstart', function(event) {
	        		that.unsetStyle();
	        	})
	        },
	        removeListenOnblur(){
	        	var bo = document.getElementsByTagName('body')[0];
	        	var that = this;
	        	bo.removeEventListener('touchstart', function(event) {
	        		
	        	})
	        },
	        //如果是安卓机,调整页面margin-bottom供用户看到input框
	        initInputStyle() {
	            let isAndroid = navigator.userAgent.indexOf("Android") > -1;
	            if (isAndroid) {

					let box = document.getElementById('afterSaleContent');
					let box2 = document.getElementById('AfterSaleOutBox');

	                let scrollTopContainer = document.body;

	                box.style.marginBottom = "45vh";
	                box2.scrollTop = 200;
//	                box2.addEventListener('scroll',function(){
//	                	console.log(box2.scrollTop)
//	                })
	                
					console.log(box.scrollTop,'滚动');
//					box.scrollTop = 1000;
					console.log(box.scrollTop,'滚动');
	                //给一个scrollTop值的变化，自动滑上去
	                let distance = parseInt(getComputedStyle(box, null).marginBottom.slice(0, -2));
	                let duration = 200 / 16.7;
	                let speed = distance / duration;
	                this.scrollAnim = setInterval(() => {
	                    scrollTopContainer.scrollTop += speed;
	                    if (scrollTopContainer.scrollTop >= distance) {
	                    	console.log("/-*****-/");
	                        scrollTopContainer.scrollTop = distance;
	                        clearInterval(this.scrollAnim);
	                    }
	                }, 16.7);
	                // document.documentElement.scrollTop
	            }
	        },
	        unsetStyle() {
//	        	console.log(999)
	            //清除计时器
	            clearInterval(this.scrollAnim);
	            this.scrollAnim = null;
				let box = document.getElementById('afterSaleContent');
				let box2 = document.getElementById('AfterSaleOutBox');
	            box.style.marginBottom = "unset";
	            box2.scrollTop = 0;
	        },
	        //监听买家留言框的focus事件  结束
		},
		mounted() {
	        this.initTextareaFocusEvent();
	       
	    },
		beforeDestroy() {
			this.upFlag = false;
		},
		computed: {
			...mapGetters("qxz", [
				"getStoreList"
			]),
			...mapGetters("wxh", [
				"sessionId",
				"userInfo"
			]),
			//此方法并未使用 
			actureBackNumData: {
				set: function(value) {
					this.actureBackNum = value;
				},
				get: function() {
					if(parseInt(this.actureBackNum) < 0) {
						//						console.log("小于0");
						return this.canBackNum;
					} else if(parseInt(this.actureBackNum) > this.canBackNum) {
						//						console.log("da于0");
						return this.canBackNum;
					} else {
						return this.actureBackNum;
					}
				}
			}
		},
		created() {
			this.getAfterSaleInfo();
		}
	}
</script>

<style scoped="scoped">
	.checkeB {}
	
	.checkeB {
		display: block;
	}
	
	.packingCase {
		-webkit-justify-content: space-between;
		justify-content: flex-start;
		/*margin-left:1rem;*/
	}
	
	.packingCase input {
		margin-top: 0.5rem;
		margin-left: 3rem;
	}
	
	.mint-popup {
		width: 100%;
	}
	
	.message_list {
		padding: 0;
		/*padding-right:0 ;*/
	}
	
	.myContent {
		width: 100%;
		height: 100%;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}
	.liuyan{
		overflow: auto;
	    padding: 0.5rem;
	    height: 2rem;
	    line-height: 1rem;
	    resize: none;
	}
	.server_show::after{
		border: 0px solid;
	}
	.edit_data_click{
		border: 1px solid #EF5423;
	}
	.edit_data_click::before{
		background: #EF5423;
	}
	.add_to_cart_no{
		border: 1px solid #a0a0a0 !important;
	}
	.add_to_cart_no::before{
		background: #a0a0a0 !important;
	}
	.add_to_cart_no::after{
		background: #a0a0a0 !important;
	}
	.lijixiadanC{
        padding:0.5rem 0.7rem;
    }
</style>